package me.firstapp.module.bbs;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import me.firstapp.module.base.CommonEntity;

/**
 * 用户积分账户
 * 
 * @author FirstApp.Me
 *
 */
@Entity
@Table(name = "MEMBER_POINT_ACCOUNT")
public class PointAccount extends CommonEntity {

	private static final long serialVersionUID = 8821808890583932881L;

	// 关联的用户
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "MEMBER_ID", referencedColumnName = "ID", unique = true, nullable = false)
	private Member member;

	// 当前余额
	@Column(name = "CURRENT_VALUE", columnDefinition = "DECIMAL(11, 2)", nullable = false)
	private Double currentValue = 0.00;

	// 盐（用于校验积分值是否被外部修改）
	@Column(name = "SALT", length = 100, nullable = false)
	private String salt;

	// 支付密码
	@Column(name = "PASSWORD", length = 100, nullable = true)
	private String password;

	// 是否有支付密码标志，0为无，1为有
	@Column(name = "HAS_PASSWORD", columnDefinition = "TINYINT DEFAULT 0", nullable = false)
	private Integer hasPassword;

	public Member getMember() {
		return member;
	}

	public void setMember(Member member) {
		this.member = member;
	}

	public Double getCurrentValue() {
		return currentValue;
	}

	public void setCurrentValue(Double currentValue) {
		this.currentValue = currentValue;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public Integer getHasPassword() {
		return hasPassword;
	}

	public void setHasPassword(Integer hasPassword) {
		this.hasPassword = hasPassword;
	}

	public String getSalt() {
		return salt;
	}

	public void setSalt(String salt) {
		this.salt = salt;
	}

}
